﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApp7
{
    public class Rainbow
    {
        public int id;
        public string title;
        public int _price;
        public int Id
        {
            get
            {
                return id;
            }
            set
            {
                id = value;
            }
        }
        public string Title
        {
            get
            {
                return title;
            }
            set
            {
                title = value;
            }
        }
        public int Price
        {
            get
            {
                return _price;
            }
            set
            {
                if (value >=1 && value <=100)
                {
                    _price = value;
                }
                else
                {
                    _price = 0;
                }
            }
        }
        public void PrintRainbowInfo()
        {
            Console.WriteLine("编号:{0} 书名:{1} 价格:{2}", this.id, this.title, this._price);
        }
        ~Rainbow()
        {
            Console.WriteLine("签售", Title);
        }
    }
}
